/*
 * Created on Wed Oct 11 2017
 * Copyright (c) 2017 jianglinjie
 */
'use strict';

var _register = require('../register');

var _register2 = _interopRequireDefault(_register);

var _captcha = require('../captcha');

var _captcha2 = _interopRequireDefault(_captcha);

var _TestConst = require('./TestConst');

var TestConst = _interopRequireWildcard(_TestConst);

var _CaptchaBusiness = require('../../constants/CaptchaBusiness');

var CaptchaBusiness = _interopRequireWildcard(_CaptchaBusiness);

require('./auth');

require('./register');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

beforeAll(_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
  var captchaResult;
  return regeneratorRuntime.wrap(function _callee$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
          _context.prev = 0;
          _context.next = 3;
          return _register2.default.registerWithUserName(TestConst.USER_NAME, TestConst.USER_NAME_PWD);

        case 3:
          _context.next = 5;
          return _captcha2.default.request({
            phone: TestConst.PHONE,
            business: CaptchaBusiness.REGISTER
          });

        case 5:
          captchaResult = _context.sent;
          _context.next = 8;
          return _register2.default.registerWithPhone(TestConst.PHONE, TestConst.PHONE_PWD, captchaResult.captcha);

        case 8:
          _context.next = 12;
          break;

        case 10:
          _context.prev = 10;
          _context.t0 = _context['catch'](0);

        case 12:
        case 'end':
          return _context.stop();
      }
    }
  }, _callee, undefined, [[0, 10]]);
}))
//ignore
);

//加载具体测试